package com.syllabus.servlet;

import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.db.DatabaseHelper;

public class GetYearServlet extends HttpServlet {
/*	private static Map<String, String[]> m = new HashMap<String, String[]>();

	static {
		m.put("CSE", new String[] { "I", "II", "III", "IV" });
		m.put("ECE", new String[] { "I", "II", "III", "IV" });
		m.put("IT", new String[] { "I", "II", "III", "IV" });
		m.put("EEE", new String[] { "I", "II", "III", "IV" });
		m.put("MARINE", new String[] { "I", "II", "III", "IV", "V" });
	}
*/
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		String dept = req.getParameter("dept");
		resp.setContentType("text/plain");
		String value = null;
		try {
			value = DatabaseHelper.getYears(dept).toString();
		} catch (Exception e) {
			e.printStackTrace();
		}
		resp.getWriter().write(value.substring(1, value.length() -1));
	}
	
}
